<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="/WEB-INF/tld/c.tld"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html lang="en">
<%@include file="inc/inc_css.jsp" %>
<body>
	<%@include file="inc/inc_head.jsp" %>
	<div id="page-content" class="single-page">
		<div class="container">
			<div class="row">
				<div class="col-lg-12">
					<div class="heading"><h1>联系我们</h1></div>
				</div>
				<div class="col-md-6" style="margin-bottom: 30px;">
					<form name="form1" id="registerFormcustomer" method="post" action="contact.php">
						<div class="form-group">
							<input type="text" class="form-control" id="phone"  name="phone" placeholder="联系电话">
						</div>
						<div class="form-group">
							<textarea class="form-control" id="content" name="content" placeholder="反馈内容"></textarea>
						</div>
						<button type="button" onclick="mineSave();" class="btn btn-1">提交</button>
					</form>
				</div>
<!-- 				<div class="col-md-6"> -->
<!-- 					<p><span class="glyphicon glyphicon-home"></span> California, United States 3000009</p> -->
<!-- 					<p><span class="glyphicon glyphicon-earphone"></span> +6221 888 888 90 , +6221 888 88891</p> -->
<!-- 					<p><span class="glyphicon glyphicon-envelope"></span> info@yourdomain.com</p> -->
<%-- 					<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3164.289259162295!2d-120.7989351!3d37.5246781!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x8091042b3386acd7%3A0x3b4a4cedc60363dd!2sMain+St%2C+Denair%2C+CA+95316%2C+Hoa+K%E1%BB%B3!5e0!3m2!1svi!2s!4v1434016649434" width="95%" height="230" frameborder="0" style="border:0"></iframe> --%>
<!-- 				</div> -->
			</div>
		</div>
	</div>
<%@include file="inc/inc_foot.jsp" %>
</body>
<script type="text/javascript">

function validate(){
	var phone = $("#phone").val();
	var content = $("#content").val();
	if ($.trim(phone) == '') {
		alert('请填写手机号码！');
		return false;
	}
	var rule = /^[1][3,4,5,7,8][0-9]{9}$/;
	if (!rule.test(phone)){
		alert('手机号码格式不对！');
		return false;
	}
	if ($.trim(content) == '') {
		alert('请填写投诉信息！');
		return false;
	}
	return true;
}
function mineSave(){
	if(validate()){
		$.ajax({
			type: "POST",
		    async:false,  // 设置同步方式
		    cache:false,
		    url: "${ctx}/front/contactSave.html",
			data:$("#registerFormcustomer").serializeArray(),
			success:function(result){
				result = eval("("+result+")");
				if(result.status=='true'||result.status==true){
					alert('反馈成功');
					window.location.reload();
				}else if(result.status == 'false' || result.status == false) {
					alert('请先登录！');
					window.location.href='register.html';
				}
		    }
		});		
	}
}
</script>
</html>
